E2E: Add regression test for spacer block in themes without spacing units#68913
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Hey @Mamaduka, Please let me know if this PR looks good to you whenever you have time 😃 |
| editor, | ||
| requestUtils, | ||
| } ) => { | ||
| await requestUtils.activateTheme( 'twentytwenty' ); |
There was a problem hiding this comment.
Switching themes can be expensive, usually done in test.beforeAll hooks. Can we find a different way to test this without switching themes?
| } ); | ||
| } ); | ||
|
|
||
| await admin.createNewPost(); |
There was a problem hiding this comment.
We can remove this. It's already handled in the test.beforeEach hook.
There was a problem hiding this comment.
Oh, I might have missed the line in the beforeEach hook. Correcting this.
| await page.evaluate( () => { | ||
| if ( window.__originalSettings ) { | ||
| window.wp.data | ||
| .dispatch( 'core/block-editor' ) | ||
| .updateSettings( window.__originalSettings ); | ||
| delete window.__originalSettings; | ||
| } | ||
| } ); |
There was a problem hiding this comment.
I think there's no need to restore old settings in this case. Reloading the subsequent tests will re-open the editor, and store data will be refetched..
There was a problem hiding this comment.
I did this since in the future if we decide to add steps to this, I must clean up the changes in the configs I made. But I see how this is a far-fetched thought, so removing it.
Mamaduka
left a comment
There was a problem hiding this comment.
Thanks, @himanshupathak95!
This looks good ✅
…nits (WordPress#68913) Co-authored-by: himanshupathak95 <abcd95@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: fullofcaffeine <fullofcaffeine@git.wordpress.org>
…nits (WordPress#68913) Co-authored-by: himanshupathak95 <abcd95@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: fullofcaffeine <fullofcaffeine@git.wordpress.org>
Closes #37922
What?
Add an E2E test to ensure the Spacer block works correctly in themes without spacing unit support. This regression test switches to the Twenty Twenty theme (which doesn't support spacing units) and verifies the Spacer block can be inserted without errors.
Why?
Previously, the Spacer block would break in themes where
useSetting( 'spacing.units' )returnedfalse. This regression test ensures this issue doesn't recur by testing the block's functionality in a theme without spacing unit support.Reference: #37774 where the original issue was fixed. This PR adds test coverage to prevent future regressions.
Testing Instructions
Run the E2E test suite: